package com.sskj.mine.util;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.support.design.widget.BottomSheetDialog;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;

import com.afollestad.materialdialogs.MaterialDialog;
import com.sskj.common.base.App;
import com.sskj.common.util.CheckUtil;
import com.sskj.common.util.ClickUtil;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.bean.FabiBuySellEnum;
import com.sskj.lib.util.CoinUtil;
import com.sskj.mine.R;

import java.math.BigDecimal;

public class MineTipUtil {
    public static MaterialDialog showShop(Context context, String shopUsdt, OnInputList onInputList) {
        MaterialDialog dialog = new MaterialDialog.Builder(context)
                .customView(R.layout.mine_shop, false)
                .autoDismiss(false)
                .cancelable(false)
                .show();
        View view = dialog.getCustomView();
        ((ViewGroup) (view.getParent())).setBackgroundColor(Color.TRANSPARENT);
        ((ViewGroup) (view.getParent().getParent())).setBackgroundColor(Color.TRANSPARENT);
        ((ViewGroup) (view.getParent().getParent().getParent())).setBackgroundColor(Color.TRANSPARENT);
        ((ViewGroup) (view.getParent().getParent().getParent().getParent())).setBackgroundColor(Color.TRANSPARENT);
        ((ViewGroup) (view.getParent().getParent().getParent().getParent().getParent())).setBackgroundColor(Color.TRANSPARENT);

        ClickUtil.click(view.findViewById(R.id.tvCancel), () -> {
            dialog.dismiss();
        });
        CheckBox checkAgree = view.findViewById(R.id.check_agree);
        TextView submitBtn = view.findViewById(R.id.submit_btn);
        TextView shopMoney = view.findViewById(R.id.shop_money);
        shopMoney.setText(String.format(App.INSTANCE.getString(R.string.mine_mineTipUtil1_j), shopUsdt));
        checkAgree.setText(String.format(App.INSTANCE.getString(R.string.mine_mineTipUtil2_j), shopUsdt));
        ClickUtil.click(submitBtn, () -> {
            if (checkAgree.isChecked()) {
                onInputList.onSure();
            } else {
                ToastUtil.showShort(App.INSTANCE.getString(R.string.mine_mineTipUtil3_j));
            }
        });
        return dialog;
    }

    public interface OnInputList {
        void onSure();
    }
}
